﻿using System.Reflection;
using Mono.Cecil;

namespace CoreEx.Common.Proxy
{
    /// <summary>
    /// Allows a constructed method to be modified during proxy generation.
    /// </summary>
    public interface IMethodModifier
    {
        /// <summary>
        /// Fires before the proxy method is constructed.
        /// </summary>
        /// <param name="targetType">The constructed proxy type that will contain the constructed method.</param>
        /// <param name="method">The target method.</param>
        void BeforeConstruction(TypeDefinition targetType, MethodInfo method);
        
        /// <summary>
        /// Fires after the proxy method has been constructed.
        /// </summary>
        /// <param name="targetType">The constructed proxy type that contains the constructed method.</param>
        /// <param name="method">The target method.</param>
        /// <param name="methodDefinition">Represents the constructed proxy method.</param>
        void AfterConstruction(TypeDefinition targetType, MethodInfo method, MethodDefinition methodDefinition);
    }
}